package net.apps.core;

public interface Channel {
	
	/** Connection, this channel belongs to */
	Connection getConnection();
	/** Channel identifier, unique withing it's connection */
	int getChannelId();
	/** Get current associated channel listener */
	ChannelListener getChannelListener();
	/** Set associated channel listener */
	void setChannelListener(ChannelListener listener);
	
	/** Put/put/offer/add some data to outbound queue, blocking if timeout > 0 */
	boolean push(Message data, long timeout);
	/** Take/get/receive some data from inbound queue, blocking if timeout > 0 */
	Message take(long timeout);
	/** Check for a message in the inbound queue, non-blocking */
	Message peek();
	
	/** Close the channel */
	void shutdown();
	
}
